package com.study.spmongodb.book.wwj.char14;

/**
 * @author study
 * @version 1.0
 * @date 2020/11/27 10:24
 */
//枚举类型本身是final，不允许被继承
public class Singleton7 {
    //实例变量
    private byte[] data = new byte[1024];

    private Singleton7() {
    }

    private enum EnumHolder {
        INSTANCE;
        private Singleton7 instance;

        EnumHolder() {
            this.instance = new Singleton7();
        }
    }

    public static Singleton7 getInstance() {
        return EnumHolder.INSTANCE.instance;
    }
}
